import React from 'react';
import { Tooltip } from 'antd';
import { Command } from 'gg-editor';
import IconFont from '../../common/IconFont';
import styles from './index.less';

const ToolbarButton = props => {
  const { command, icon, text ,zch} = props;

  return (
    <div>
      {
        !text?
          <Command name={command}>
            <Tooltip
              title={zch}
              placement="bottom"
              overlayClassName={styles.tooltip}
            >
              <IconFont type={`icon-${icon || command}`} />
            </Tooltip>
          </Command>
          :
          <span style={{float:'right'}} >
            <IconFont type={`icon-${icon }`}  />{text}
          </span>
      }
    </div>
  );
};

export default ToolbarButton;
